Program 1

             CSCI 271             

Purpose

Work with the STL - list type

Problem Statement

We will be creating a piece of a GPS information system. All this very small piece does is tell you which exits are closest to your current exit. Additionally, we will restrict ourselves to I-95 in Florida.

Details

You will read a master list from the file master.dat.  In this file will be an exit name (at most 20 characters with no blanks in the name) and the exit mile marker each separated by white space.  You will insert these values into a doubly linked list in mile marker order.

Next you will read from groups.dat (repeatedly until end of file) a name, and a group size (an integer).   You will then find this exit on your master list and print out the "group size" number of exits that are the closest ages to the selected exit.  The group may not be symmetrical.  For a group of size 10, there may be 3 exits south of the one we are considering and 7 north of the exit we are considering. Use the STL list class, which is a doubly linked list. Also, there may not be enough exits in the master list to satisfy the requested number of results.

Implementation

You will implement a function that is passed the master linked list, the exit name, and the size of the group. The function will return a list with all the items that meet the criteria.  The main will be repeatedly reading from the groups file and calling this function then printing out the list returned.  It is here that it will be reported if we could not fulfill the number of requested results.

The person that is the basis for the peer group will  NOT be counted as one of the group members.

If when adding the last person to the group there is a tie (a lower mile marker and a higher mile marker have the same distance from the exit read in from groups.dat), then use the exit with the higher mile marker.

What to turn in

You are to email me your program with the code as an attachment.  You may tar it if you wish.  Also, turn in a printout of your program. 2 points (out of 20) penalty for each day late.  It is due at the beginning of class on the due date.